<div class="main_body">
    <?php echo $this->element('main_menu')?>			
	<div id="main_body_content">
	
		<div class="orders view">
		<h1><?php  __("Order");?></h1>
			<dl><?php $i = 0; $class = ' class="altrow"';?>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Id"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['id']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Customer"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $this->Html->link($order['Customer']['name'], array('controller' => 'customers', 'action' => 'view', $order['Customer']['id'])); ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Type Of Service"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $this->Html->link($order['TypeOfService']['name'], array('controller' => 'type_of_services', 'action' => 'view', $order['TypeOfService']['id'])); ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Types Of Spaces"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $this->Html->link($order['TypesOfSpaces']['name'], array('controller' => 'types_of_spaces', 'action' => 'view', $order['TypesOfSpaces']['id'])); ?>
					&nbsp;
				</dd>	
				<div class="clr"></div>		
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Status Implement."); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['status_of_implementation']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Payment Status"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['payment_status']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Estimated Time"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['estimated_execution_time']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Value Of The Order"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['value_of_the_order']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Name"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['name']; ?>
					&nbsp;
				</dd>
				
				<?php if($session->read('Auth.User.group') == 'manag' || $session->read('Auth.User.group') == 'admin'){?>				
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Note Manager"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['note_manager']; ?>
					&nbsp;
				</dd>	
				<?php }?>
				<?php if($session->read('Auth.User.group') == 'manag' || $session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'firms'){?>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Note Customer"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['note_customer']; ?>
					&nbsp;
				</dd>
				<?php }?>
				<?php if($session->read('Auth.User.group') == 'manag' || $session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'emplo'){?>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Note Employee"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['Order']['note_employee']; ?>
					&nbsp;
				</dd>	
				<?php }?>		
			</dl>
		</div>

		<div class="clr"></div>
		
		<div class="related index">
			<h1><?php __("Related Employees");?></h1>
			<?php if (!empty($order['Employee'])):?>
			<table cellpadding = "0" cellspacing = "0">
			<tr>
				<th><?php __("Id"); ?></th>
				<th><?php __("First Name"); ?> <?php __("Last Name"); ?></th>
				<th><?php __("Address"); ?></th>
				<th><?php __("Phones"); ?></th>
				<th><?php __("Ssn Irs"); ?><br/><?php __("Numer Id"); ?></th>
				<th class="actions"><?php __("Actions");?></th>
			</tr>
			<?php
				$i = 0;
				foreach ($order['Employee'] as $employee):
					$class = null;
					if ($i++ % 2 == 0) {
						$class = ' class="altrow"';
					}
				?>
				<tr<?php echo $class;?>>
					<td><?php echo $employee['id'];?></td>
					<td><?php echo $employee['name'];?> <?php echo $employee['surname'];?><br/><?php echo $typeOfWorks[$employee['type_of_work_id']];?></td>
					<td><?php echo $employee['address1'];?><br/><?php echo $employee['address2'];?><br/>
						<?php echo $employee['address3'];?><br/><?php echo $employee['address4'];?></td>
					<td><?php echo $employee['phone1'];?><br/>
						<?php echo $employee['phone2'];?><br/>
						<?php echo $employee['phone3'];?></td>
					<td><?php echo $employee['ssn_irs'];?><br/><?php echo $employee['numer_id'];?></td>
					<td class="actions">
						<?php if($session->read('Auth.User.group') != 'emplo' && $session->read('Auth.User.group') != 'firms'){?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_message_send.png'), array('controller'=>'messages','action' => 'add', $employee['user_id']),array('escape'=>false,'title'=>__("Send Email", true))); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_view.png'), array('controller' => 'employees', 'action' => 'view', $employee['id']),array('title'=>__("View", true),'escape'=>false)); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_edit.png'), array('controller' => 'employees', 'action' => 'edit', $employee['id']),array('title'=>__("Edit", true),'escape'=>false)); ?>
						<?php echo $this->Html->link($html->image(HOST.'/actions_16_delete.png'), array('controller' => 'orders_employees', 'action' => 'delete', $employee['OrdersEmployee']['id']), array('title'=>__("Delete From Order", true),'escape'=>false), sprintf(__("Are you sure you want to delete # %s?", true), $employee['id'])); ?>
						<?php }?>
					</td>
				</tr>
			<?php endforeach; ?>
			</table>
		<?php endif; ?>		
		</div>
		<div class="clr"></div>	
		
		<div class="related index">
			<h1><?php __("Order Cycles");?></h1>
			<dl><?php $i = 0; $class = ' class="altrow"';?>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Date start"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['OrdersCycle']['date_start']; ?>
					&nbsp;
				</dd>
				<div class="clr"></div>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Date end"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php echo $order['OrdersCycle']['date_end']; ?>
					&nbsp;
				</dd>
			</dl>
			<div class="clr"></div>
			<?php if ($order['OrdersCycle']['type_of_cycle_id'] == 1 ){?>
			<table cellpadding="0" cellspacing="0" class="items" id="repeat_for_month">
				<tr>
					<td align="center" valign="middle">1<div class="clr"></div><?php echo ($order['OrdersCycle']['_1'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">2<div class="clr"></div><?php echo ($order['OrdersCycle']['_2'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">3<div class="clr"></div><?php echo ($order['OrdersCycle']['_3'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">4<div class="clr"></div><?php echo ($order['OrdersCycle']['_4'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">5<div class="clr"></div><?php echo ($order['OrdersCycle']['_5'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">6<div class="clr"></div><?php echo ($order['OrdersCycle']['_6'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">7<div class="clr"></div><?php echo ($order['OrdersCycle']['_7'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">8<div class="clr"></div><?php echo ($order['OrdersCycle']['_8'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">9<div class="clr"></div><?php echo ($order['OrdersCycle']['_9'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">10<div class="clr"></div><?php echo ($order['OrdersCycle']['_10'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">11<div class="clr"></div><?php echo ($order['OrdersCycle']['_11'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">12<div class="clr"></div><?php echo ($order['OrdersCycle']['_12'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">13<div class="clr"></div><?php echo ($order['OrdersCycle']['_13'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">14<div class="clr"></div><?php echo ($order['OrdersCycle']['_14'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">15<div class="clr"></div><?php echo ($order['OrdersCycle']['_15'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle" class="actions">16<div class="clr"></div><?php echo ($order['OrdersCycle']['_16'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
				</tr>
				<tr>
					<td align="center" valign="middle">17<div class="clr"></div><?php echo ($order['OrdersCycle']['_17'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">18<div class="clr"></div><?php echo ($order['OrdersCycle']['_18'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">19<div class="clr"></div><?php echo ($order['OrdersCycle']['_19'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">20<div class="clr"></div><?php echo ($order['OrdersCycle']['_20'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">21<div class="clr"></div><?php echo ($order['OrdersCycle']['_21'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">22<div class="clr"></div><?php echo ($order['OrdersCycle']['_22'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">23<div class="clr"></div><?php echo ($order['OrdersCycle']['_23'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">24<div class="clr"></div><?php echo ($order['OrdersCycle']['_24'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">25<div class="clr"></div><?php echo ($order['OrdersCycle']['_25'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">26<div class="clr"></div><?php echo ($order['OrdersCycle']['_26'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">27<div class="clr"></div><?php echo ($order['OrdersCycle']['_27'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">28<div class="clr"></div><?php echo ($order['OrdersCycle']['_28'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">29<div class="clr"></div><?php echo ($order['OrdersCycle']['_29'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" valign="middle">30<div class="clr"></div><?php echo ($order['OrdersCycle']['_30'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>						
					<td align="center" valign="middle">31<div class="clr"></div><?php echo ($order['OrdersCycle']['_31'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td class="actions">&nbsp;</td>
				</tr>
			</table>
			<?php }else if($order['OrdersCycle']['type_of_cycle_id'] == 2){ ?>
			<table cellpadding="0" cellspacing="0" class="items"  id="repeat_for_week">
				<tr>
					<td align="center"><?php echo __("Poniedzialek",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_1'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center"><?php echo __("Wtorek",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_2'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center"><?php echo __("Sroda",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_3'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center"><?php echo __("Czwartek",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_4'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center"><?php echo __("Piatek",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_5'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center"><?php echo __("Sobota",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_6'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
					<td align="center" class="actions"><?php echo __("Niedziela",true)?><div class="clr"></div><?php echo ($order['OrdersCycle']['_7'] == 1)? $html->image(HOST.'/checkbox_checked.png'):$html->image(HOST.'/checkbox_unchecked.png');?></td>
				</tr>
			</table>
			<div class="clr"></div>
			<?php echo __("Repeat every ",true).' <strong>'.$order['OrdersCycle']['repeat'].'</strong>'.(($order['OrdersCycle']['type_of_cycle_id'] == 1)?__(" month",true):__(" week",true))?>
			<?php }?>
			<h1><?php __("Order Breaks");?></h1>
			<?php foreach ($order['OrdersBreak'] as $b) {?>
			<dl><?php $i = 0; $class = ' class="altrow"';?>
				<dt<?php if ($i % 2 == 0) echo $class;?>><?php __("Date"); ?></dt>
				<dd<?php if ($i++ % 2 == 0) echo $class;?>>
					<?php __("from")?>&nbsp;<?php echo $b['date_start']; ?>&nbsp;<?php __("to")?>&nbsp;<?php echo $b['date_end']; ?>
				</dd>
				<div class="clr"></div>
			</dl>
			<div class="clr"></div>
			<?php }?>	
			<br/>			
		</div>		
	</div>	
		
	<?php echo $this->element('languages')?>	
	<div class="clr"></div>


</div>	
<div class="clr"></div>	
<div class="main_action">
	<div class="main_action_content">
	
		<div class="actions">
			<h3><?php __("Actions"); ?></h3>
			<ul>
			<?php if($session->read('Auth.User.group') != 'emplo' && $session->read('Auth.User.group') != 'firms'){?>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_edit.png'), array('action' => 'edit', $order['Order']['id']),array('title'=>__("Edit Order", true),'escape'=>false)); ?><div class="clr"></div><?php echo __("Edit Order",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_delete.png'), array('action' => 'delete', $order['Order']['id']),array('title'=>__("Delete Order", true),'escape'=>false), sprintf(__("Are you sure you want to delete # %s?", true), $order['Order']['id'])); ?> <div class="clr"></div><?php echo __("Delete Order",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_list.png'), array('action' => 'index'),array('title'=>__("List Orders", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("List Orders",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_orders_add.png'), array('action' => 'add'),array('title'=>__("New Order", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("New Order",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_customers.png'), array('controller' => 'customers', 'action' => 'index'),array('title'=>__("List Customers", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("List Customers",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_customer_add.png'), array('controller' => 'customers', 'action' => 'add'),array('title'=>__("New Customer", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("New Customer",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_services.png'), array('controller' => 'type_of_services', 'action' => 'index'),array('title'=>__("List Type Of Services", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("List Type Of Services",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_services_add.png'), array('controller' => 'type_of_services', 'action' => 'add'),array('title'=>__("New Type Of Service", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("New Type Of Service",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_spaces.png'), array('controller' => 'types_of_spaces', 'action' => 'index'),array('title'=>__("List Types Of Spaces", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("List Types Of Spaces",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_spaces_add.png'), array('controller' => 'types_of_spaces', 'action' => 'add'),array('title'=>__("New Types Of Spaces", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("New Types Of Spaces",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_employees.png'), array('controller' => 'employees', 'action' => 'index'),array('title'=>__("List Employees", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("List Employees",true)?></li>
				<li><?php echo $this->Html->link($html->image(HOST.'/actions_employee_add.png'), array('controller' => 'employees', 'action' => 'add'),array('title'=>__("New Employee", true),'escape'=>false)); ?> <div class="clr"></div><?php echo __("New Employee",true)?></li>
			<?php }?>				
			</ul>
		</div>	
	
		<div class="clr"></div>					
	</div>		
</div>